class HeadUI extends eui.Component {
    public headMask: eui.Image;
    public headImg: ImageComponent;
    public headzhuang: eui.Image;
    public nameGrp: eui.Group;
    public nameLabel: eui.Label;
    public goldLabel: eui.Label;
    public heroImg: eui.Image;
    public relateImg: eui.Image;

    public userID: number = 0;   //用户ID

    public constructor() {
        super();
        this.skinName = "headUISkin1";
    }

    public childrenCreated() {
        this.headImg.mask = this.headMask;
        this.reset();
    }

    public update(user: UserVO) {
        this.userID = user.userID;
        this.headImg.loadImg(user.headUrl);
        this.nameLabel.text = user.nickName;
        this.goldLabel.text = user.gold.toString();
        this.nameGrp.visible = true;
    }

    public reset() {
        this.headImg.source = "img_default_png";
        this.nameGrp.visible = false;
        this.headzhuang.visible = false;
        this.heroImg.visible = false;
        this.relateImg.visible = false;
        this.goldLabel.text = "0";
        this.nameLabel.text = "";
    }
}
